<!DOCTYPE html> 
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0, user-scalable=0" name="viewport" />        
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" /> 
<meta content="telephone=no" name="format-detection" /> 
<title>选择顾投</title>
<link rel="stylesheet" href="css/select.css">
</head>
<body>
<div class="container">
	<div class="top-bar">
		<div class="top-l">长沙市枫林三路营业部</div>
		<div class="top-r">
			<span>更换</span>
		</div>
	</div>

	<div class="main">
	<div class="left-nav">
		<div class="nav" teamId="1">
			<div class="nav-inner">
				<span>团队名称团队名称称称称</span>
			</div>
		</div>
		<div class="nav" teamId="2">
			<div class="nav-inner">
				<span>团队名称</span>
			</div>
		</div>
		<div class="nav" teamId="3">
			<div class="nav-inner">
				<span>团队名称</span>
			</div>
		</div>
	</div>

	<div class="right-container">
		<div class="p-wrap">
			<!-- <div class="p-box">
				<div class="p-top flex">
					<div class="pic">
						<img src="images/usr_pic.png" alt="头像">
					</div>
					<div class="infos flex-1">
						<div class="name_btn">
							<div class="name">王佳宇</div>
							<div class="select">
								<a href="javascript:;" class="btn">选择</a>
							</div>
						</div>
						<div class="book">
							资格证书：S1220601504001
						</div>
					</div>
				</div>
				<div class="des">
					方正证券太原新建南路营业厅投资顾问，大学本科学历。
				</div>
			</div> -->


		</div>
		<!-- <div class="p-wrap hidden">111</div>
		<div class="p-wrap hidden">2222</div> -->
		<div class="empty">
			<img src="images/jttb@2x.png" alt="">
			<p>请选择团队</p>
		</div>
	</div>
	</div>

	<div class="none hidden">
		<img src="images/info_icon@2x.png" alt="">
		<p>该营业部暂无可<br>签约的投顾</p>
	</div>

</div>
<script src="js/lib/jquery-1.11.1.min.js"></script>
<script src="js/build/lib.js" type="text/javascript"></script>
<script>
var selectPage = {
	init: function(){
		// 兼容按压效果
		document.body.addEventListener('touchstart', function () { //...空函数即可
		});
		this.getPart();
	},
	events: function(){
		// 更换是否显示 
		var _isShow = true;
		if(_isShow){
			$('.top-r').show();
		}else{
			$('.top-r').hide();
		}

		// 更换部门 
		$('.top-r').hammer().on('tap',function(){
			window.location = 'selectDep.html';
		});

		// 选择团队
		$('.nav').hammer().on('tap',function(){
			var _index = $('.nav').index($(this));
				_teamId = $(this).attr('teamId');

			$(this)
				.addClass('active')
				.siblings('.nav')
				.removeClass('active');
			console.log(_teamId);
			$.ajax({
            	dataType: "json",
				type: 'GET',
				data: {
					"teamid":_teamId
				},
				url: "json/e.json",
				success: function(data){
					console.log(data.menbers);
					var str = "";
					for(var i=0; i<data.menbers.length; i++){
					str += '<div class="p-box" usrId = "'+data.menbers[i].id +'">'
								+'<div class="p-top flex">'
									+'<div class="pic">'
										+'<img src="'+data.menbers[i].pic +'" alt="头像">'
									+'</div>'
									+'<div class="infos flex-1">'
										+'<div class="name_btn">'
											+'<div class="name">'+data.menbers[i].name+'</div>'
											+'<div class="select">'
												+'<a href="javascript:;" class="btn">选择</a>'
											+'</div>'
										+'</div>'
										+'<div class="book">资格证书：'+data.menbers[i].code+'</div>'
									+'</div>'
								+'</div>'
								+'<div class="des">'+data.menbers[i].content+'</div>'
							+'</div>';

					}
					$('.empty').hide();
					$('.p-wrap').empty().append(str);

				}

			});
			
			// $('.p-wrap')
			// 	.hide()
			// 	.eq(_index)
			// 	.show();

		});

		// 选择成员
		$('.p-wrap').delegate('.p-box','click',function(){
			var _menberid = $(this).attr('usrId');
				_name = $(this).find('.name').text();
				console.log(_menberid,_name);
				sessionStorage.setItem("name", _name);
				window.location = 'affirmOrder3.html';
		})

	},
	getPart: function(){
		var _partId = sessionStorage.getItem("partId");

		if(_partId){
			var _partName = sessionStorage.getItem("partName");
			$('.top-l').text(_partName);
			$('.top-l').attr('partId',_partId);
		}
	},

	run: function(){
		this.init();
		this.events();

	}
};
selectPage.run();
</script>
</body>
</html>